<?$currentRoundStatus = getCurrentRoundStatus();
$myTeam = new SelectedTeam(getSelectedTeam($currentTeam->id), $currentTeam->teamName);
$yourPicks = new SelectedTeam(getPicks($currentTeam->id, true, $leagueId), $currentTeam->teamName);
$haveProposedTrades = haveProposedTrades($currentTeam);
$haveConfirmedTrades = haveConfirmedTrades($currentTeam, $forAdmin);
$haveRejectedTrades = haveRejectedTrades($currentTeam, $forAdmin);
$haveInvalidTrades = haveInvalidTrades($currentTeam, $forAdmin);
$takenUsedPrefs = getTakenUsedPreferences($currentTeam->id, $forAdmin);
$hasSkippedPicks = getSkippedPicks($currentTeam->id);
$makeMyPickError = false;
$submitTeamError = false;
if (isset($_GET['makeMyPickError'])) {
	$makeMyPickError = true;	
}
if (isset($_GET['submitTeamError'])) {
	$submitTeamError = true;	
}

$ltiReturns = getReturnedLtisForCoach($currentTeam->id);
?>
<script>
function showYourPicksDiv() {
	document.getElementById('yourPicksDiv').style.display = 'block';
	document.getElementById('yourPicksLink').innerHTML = "<a href='javascript: hideYourPicksDiv()'>Hide Your Picks</a>";
}
function hideYourPicksDiv() {
	document.getElementById('yourPicksDiv').style.display = 'none';
	document.getElementById('yourPicksLink').innerHTML = "<a href='javascript: showYourPicksDiv()'>Show Your Picks</a>";
}
function showYourTradesDiv() {
	document.getElementById('yourTradesDiv').style.display = 'block';
	document.getElementById('yourTradesLink').innerHTML = "<a href='javascript: hideYourTradesDiv()'>Hide Your Trades</a>";
}
function hideYourTradesDiv() {
	document.getElementById('yourTradesDiv').style.display = 'none';
	document.getElementById('yourTradesLink').innerHTML = "<a href='javascript: showYourTradesDiv()'>Show Your Trades</a>";
}
</script>
<b>Round Status:</b>&nbsp;&nbsp;<b><font color="red"><?echo $currentRoundStatus?></font></b>
<table align="center" width="100%" cellpadding="5">
	<tr>
	<td colspan="2">	
	<? if ($isYourPick || $haveProposedTrades || $haveConfirmedTrades || $haveRejectedTrades || $haveInvalidTrades || ($takenUsedPrefs != null && count($takenUsedPrefs) > 0) || $hasSkippedPicks || $makeMyPickError || $submitTeamError || ($ltiReturns != null && count($ltiReturns) > 0)) {?>
	<div class="ui-widget">
			<? if ($isYourPick) {?>
			<!--div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;"> 
				<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
				<strong>It's Your Pick</strong></p>
			</div-->
			<?}?>
			<? if ($ltiReturns != null && count($ltiReturns) > 0) {?>			
			<div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;"> 
				<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
				<strong>
				The following players have returned from Long Term Injury either via the 2nd's competition or are named for their AFL team:<br>
				<?foreach ($ltiReturns as $ltiReturn) {?>
				<?echo $ltiReturn->playerOne->getDescription()?><br> 
				<?}?>
				Return either the LTI player or his replacement to the APL. You can do this on the "Pick Team" tab by clicking the remove button next to the LTI player.
				</strong></p>
			</div>
			<?}?>			
			<? if ($submitTeamError) {?>			
			<div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;"> 
				<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
				<strong>Round is now in LOCKOUT, teams can no longer be submitted</strong></p>
			</div>
			<?}?>			
			<? if ($haveProposedTrades) {?>			
			<div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;"> 
				<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
				<strong>You have Proposed trades</strong></p>
			</div>
			<?}?>
			<? if ($haveConfirmedTrades) {?>			
			<div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;"> 
				<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
				<strong>You have Confirmed trades</strong></p>
			</div>
			<?}?>
			<? if ($haveRejectedTrades) {?>			
			<div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;"> 
				<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
				<strong>You have Rejected trades</strong></p>
			</div>
			<?}?>
			<? if ($haveInvalidTrades) {?>			
			<div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;"> 
				<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
				<strong>You have Invalid trades</strong></p>
			</div>
			<?}?>			
			<? if ($hasSkippedPicks) {?>			
			<!--div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;"> 
				<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
				<strong>You have missed a pick and it has been skipped. Go to Make my Pick to catch up.</strong></p>
			</div-->
			<?}?>			
			<? if ($takenUsedPrefs != null && count($takenUsedPrefs) > 0) {?>			
			<div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
				<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
				<?$prefCount = count($takenUsedPrefs);
				for ($r = 0; $r < $prefCount; $r++) {
				?> 
				<strong>preference <?echo $takenUsedPrefs[$r]->getDescription()?> was <?echo $takenUsedPrefs[$r]->state?></strong><br>
				<?}?>
				</p>
			</div>
			<?}?>
			<? if ($makeMyPickError) {?>
			<div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;"> 
				<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
				<strong>The player you tried to pick was already selected!</strong></p>
			</div>
			<?}?>
		</div>
		<br>
		<br>
		<br>
		<?}?>
		</td>
	</tr>
	<tr>
		<td width="50%" valign="top">
		<?if ($settings->seasonInProgress == "YES") {?><?php include("../html/ladder-" . $leagueId . ".htm"); ?><?} else {?><?php include("showTeam.php"); ?><?}?></td>
		<td width="50%" valign="top">
		<?if ($settings->seasonInProgress == "YES") {?><?php include("showTeam.php"); ?><?} else {?><?php include("showPicks.php"); ?><?}?>
		</td>		
	</tr>
	<tr>
		<td>
		<?if ($settings->seasonInProgress == "YES") {?><?php include("showPicks.php"); ?><?} else {?><?php include("showTrades.php"); ?><?}?>
		</td>
		<td width="35%" valign="top"><?if ($settings->seasonInProgress == "YES") {?><?php include("showTrades.php"); ?><?}?></td>
	</tr>
</table>